

/****** Object:  StoredProcedure [dbo].[web_del_vouncher]    Script Date: 10/19/2013 09:20:36 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

IF EXISTS (SELECT * FROM sys.objects WHERE type = 'P' AND name = 'web_del_vouncher')
DROP PROCEDURE web_del_vouncher
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[web_del_vouncher]
	@id int
AS
BEGIN
	SET NOCOUNT ON
	if (exists(select * from KvitoGalva where import=1 and id = @id))
	begin
		begin transaction			
			delete from KvitoEilute where GalvosId = @id;
			delete from KvitoGalva where id = @id;
		commit transaction
    end
END

GO

